// pages/dailiangfang/measureroom.js
Page({
  data: {
    scrollviewheight: '',
    ci_rwdid: '',
    WorksID: '',
    CustomerID: '',
    CatalogID: '',
    baseimageurl: 'http://img0.wenes.cn:8099/Upload/Project/',
    showView: true,
    showView2: true,
    showView3: true,
    showView4: true,
    showView5: true,
    showView6: true,
    showView7: true,
    showView8: true,
    ca_ca_HousingSituation: '',   //房屋现状
    ca_HouseOrientation: '',      //房屋朝向
    ca_OccupyPublicCorridor: '',  //占用公共过道
    ca_isGroundSmooth: '',        //地面是否平整
    ca_CargoDoorHight: '',        //货梯门高度
    ca_CargoDoorWide: '',         //货梯门宽度
    ca_OriginalGroundMaterial: '',//原地面材质
    ca_OriginalWallMaterial: '',   //原墙面材质
    ca_OriginalTopMaterial: '',   //原顶面材质
    ca_GroundElevation: '',       //地面高差
    ca_SpaceMaxHeight: '',        //空间最高点
    ca_SpaceMinHeight: '',        //空间最低点
    ca_mainBeamHeight: '',        //主梁下
    ca_SecondaryHeight: '',       //次梁下
    ca_MinimumSprayHeight: '',    //喷淋最低点
    ca_AirConditionerNum: '',     //空调设备个数
    ca_TuyereMinimumHeight: '',   //风口最低点
    ca_StrongBoxNum: '',          //强电箱个数
    ca_WeakBoxNum: '',            //弱电箱个数
    ca_UpWaterSpot: '',           //上水点
    ca_DownWaterSpot: '',         //下水点
    ca_DownWaterSpotSize: '',     //下水管径
    ca_CurtainWallSpacing: '',    //幕墙架间距
    ca_WindowType: '',            //窗户类型
    ca_windowsillHight: '',       //窗台高
    ca_WindowHight: '',           //窗户高

    // 图册数组
    array1: [], // 量房手绘	123
    array2: [], // 周边环境	124
    array3: [], // 室内全景照片	125
    array4: [], // 墙	126
    array5: [], // 顶	127
    array6: [], // 地	128
    array7: [], // 门	129
    array8: [], // 空调	130
    array9: [], // 消防	131
    array10: [],// 强电箱	132
    array11: [],// 弱电箱	133
    array12: [],// 上下水	134

  },

  onLoad: function (options) {
    var rwdid = options.ci_rwdid
    var that = this
    that.setData({
      ci_rwdid: options.ci_rwdid,
    })
    // 获取系统高度
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          scrollviewheight: res.screenHeight - 120
        })
      },
    })

    // 数据请求接口一
    wx.request({
      url: 'https://api.wenes.cn/JD/GetClientDetailInfo?ci_rwdid=' + that.data.ci_rwdid,
      success: function (res) {
        console.log('量房详情页 ', res.data.Table)
        var item = res.data.Table[0]
        that.setData({
          WorksID: item.WorksID,
          CustomerID: item.CustomerID,
          ca_ca_HousingSituation: item.ca_ca_HousingSituation,
          ca_HouseOrientation: item.ca_HouseOrientation,
          ca_OccupyPublicCorridor: item.ca_OccupyPublicCorridor,
          ca_isGroundSmooth: item.ca_isGroundSmooth,
          ca_CargoDoorHight: item.ca_CargoDoorHight,
          ca_CargoDoorWide: item.ca_CargoDoorWide,
          ca_OriginalGroundMaterial: item.ca_OriginalGroundMaterial,
          ca_OriginalWallMaterial: item.ca_OriginalWallMaterial,
          ca_OriginalTopMaterial: item.ca_OriginalTopMaterial,
          ca_GroundElevation: item.ca_GroundElevation,
          ca_SpaceMaxHeight: item.ca_SpaceMaxHeight,
          ca_SpaceMinHeight: item.ca_SpaceMinHeight,
          ca_mainBeamHeight: item.ca_mainBeamHeight,
          ca_SecondaryHeight: item.ca_SecondaryHeight,
          ca_MinimumSprayHeight: item.ca_MinimumSprayHeight,
          ca_AirConditionerNum: item.ca_AirConditionerNum,
          ca_TuyereMinimumHeight: item.ca_TuyereMinimumHeight,
          ca_StrongBoxNum: item.ca_StrongBoxNum,
          ca_WeakBoxNum: item.ca_WeakBoxNum,
          ca_UpWaterSpot: item.ca_UpWaterSpot,
          ca_DownWaterSpot: item.ca_DownWaterSpot,
          ca_DownWaterSpotSize: item.ca_DownWaterSpotSize,
          ca_CurtainWallSpacing: item.ca_CurtainWallSpacing,
          ca_WindowType: item.ca_WindowType,
          ca_windowsillHight: item.ca_windowsillHight,
          ca_WindowHight: item.ca_WindowHight,
        })
      }
    })
  },

  /**
     * 生命周期函数--监听页面显示
     */
  onShow: function () {
    console.log('onShow')
    var that = this
    //获取网络数据
    that.requestPic(that.data.ci_rwdid)
  },

  /**
   * 获取照片urls
   */
  requestPic: function (ci_rwdid) {
    var that = this
    // 图册数组
    var array1 = []
    var array2 = []
    var array3 = []
    var array4 = []
    var array5 = []
    var array6 = []
    var array7 = []
    var array8 = []
    var array9 = []
    var array10 = []
    var array11 = []
    var array12 = []
    // 数据请求接口二
    wx.request({
      url: 'https://api.wenes.cn/JD/GetAllImages?ci_rwdid=' + ci_rwdid,
      success: function (res) {
        var length = res.data.Table.length
        console.log(res.data)
        that.setData({
          array1: [],
          array2: [],
          array3: [],
          array4: [],
          array5: [],
          array6: [],
          array7: [],
          array8: [],
          array9: [],
          array10: [],
          array11: [],
          array12: []
        })
        for (var i = 0; i < length; i++) {
          if (res.data.Table[i].CatalogID == '123') {
            array1.push(res.data.Table[i].ImageUrl)
            that.setData({
              array1: array1
            })
          }
          if (res.data.Table[i].CatalogID == '124') {
            array2.push(res.data.Table[i].ImageUrl)
            that.setData({
              array2: array2
            })
          }
          if (res.data.Table[i].CatalogID == '125') {
            array3.push(res.data.Table[i].ImageUrl)
            that.setData({
              array3: array3
            })
          }

          if (res.data.Table[i].CatalogID == '126') {
            array4.push(res.data.Table[i].ImageUrl)
            that.setData({
              array4: array4
            })
          }
          if (res.data.Table[i].CatalogID == '127') {   // 顶面
            array5.push(res.data.Table[i].ImageUrl)
            that.setData({
              array5: array5
            })
          }
          if (res.data.Table[i].CatalogID == '128') {   // 地面
            array6.push(res.data.Table[i].ImageUrl)
            that.setData({
              array6: array6
            })
          }

          if (res.data.Table[i].CatalogID == '129') {
            array7.push(res.data.Table[i].ImageUrl)
            that.setData({
              array7: array7
            })
          }
          if (res.data.Table[i].CatalogID == '130') {
            array8.push(res.data.Table[i].ImageUrl)
            that.setData({
              array8: array8
            })
          }
          if (res.data.Table[i].CatalogID == '131') {
            array9.push(res.data.Table[i].ImageUrl)
            that.setData({
              array9: array9
            })
          }

          if (res.data.Table[i].CatalogID == '132') {
            array10.push(res.data.Table[i].ImageUrl)
            that.setData({
              array10: array10
            })
          }
          if (res.data.Table[i].CatalogID == '133') {
            array11.push(res.data.Table[i].ImageUrl)
            that.setData({
              array11: array11
            })
          }
          if (res.data.Table[i].CatalogID == '134') {
            array12.push(res.data.Table[i].ImageUrl)
            that.setData({
              array12: array12
            })
          }
        }
      }
    })
  },

  // 点击相册
  uploadimage123: function (e) {
    var that = this
    if (that.data.array1.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=123&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array1 == 0) {
      that.uploadPic('123')
    }
  },
  uploadimage124: function (e) {
    var that = this
    if (that.data.array2.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=124&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array2 == 0) {
      that.uploadPic('124')
    }
  },
  uploadimage125: function (e) {
    var that = this
    if (that.data.array3.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=125&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array3 == 0) {
      that.uploadPic(125)
    }
  },
  uploadimage126: function (e) {
    var that = this
    if (that.data.array4.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=126&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array4 == 0) {
      that.uploadPic('126')
    }
  },
  uploadimage127: function (e) {
    var that = this
    if (that.data.array5.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=127&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array5 == 0) {
      that.uploadPic('127')
    }
  },
  uploadimage128: function (e) {
    var that = this
    if (that.data.array6.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=128&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array6 == 0) {
      that.uploadPic('128')
    }
  },
  uploadimage129: function (e) {
    var that = this
    if (that.data.array7.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=129&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array7 == 0) {
      that.uploadPic('129')
    }
  },
  uploadimage130: function (e) {
    var that = this
    if (that.data.array8.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=130&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array8 == 0) {
      that.uploadPic('130')
    }
  },
  uploadimage131: function (e) {
    var that = this
    if (that.data.array9.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=131&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array9 == 0) {
      that.uploadPic('131')
    }
  },
  uploadimage132: function (e) {
    var that = this
    if (that.data.array10.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=132&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array10 == 0) {
      that.uploadPic('132')
    }
  },
  uploadimage133: function (e) {
    var that = this
    if (that.data.array11.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=133&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array11 == 0) {
      that.uploadPic('133')
    }
  },
  uploadimage134: function (e) {
    var that = this
    if (that.data.array12.length > 0) {
      wx.navigateTo({
        url: 'album?ci_rwdid=' + that.data.ci_rwdid + '&CatalogID=134&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID
      })
    }
    if (that.data.array12 == 0) {
      that.uploadPic('134')
    }
  },
  // 本地选择图片
  uploadPic: function (CatalogID) {
    var that = this
    wx.chooseImage({
      success: function (res) {
        var tempFilePaths = res.tempFilePaths
        // 上传图片
        wx.uploadFile({
          url: 'https://api.wenes.cn/jd/UploadJDimages',
          filePath: tempFilePaths[0],
          name: 'Filedata',
          formData: {
            'qt': 'upload',
            'type': '1',
            'W': '500',
            'H': '300',
            'HW': 'HW',
            'WorksID': that.data.WorksID,
            'CatalogID': CatalogID,
            'UserId': that.data.CustomerID,
          },
          success: function (res) {
            console.log(res)
            if (res.statusCode == 200) {
              wx.showToast({
                title: '成功',
                icon: 'success',
                duration: 2000
              })
              // 实时刷新
              that.requestPic(that.data.ci_rwdid)
            } else {
              wx.showToast({
                title: '失败',
                icon: 'failure',
                duration: 2000
              })
            }
          }
        })
      },
    })
  },

  //点击标题隐藏和显示
  title_situation: function () {
    var that = this
    that.setData({
      showView: (!that.data.showView)
    })
  },
  // 点击选项卡--房屋现状
  selector_situation1: function (e) {
    var that = this
    that.setData({
      showView: (!that.data.showView),
      ca_ca_HousingSituation: 1
    })
    // wx.setStorage({
    //   key: 'ca_ca_HousingSituation',
    //   data: that.data.ca_ca_HousingSituation,
    // })
  },
  selector_situation2: function (e) {
    var that = this
    that.setData({
      showView: (!that.data.showView),
      ca_ca_HousingSituation: 2
    })
    // wx.setStorage({
    //   key: 'ca_ca_HousingSituation',
    //   data: that.data.ca_ca_HousingSituation,
    // })
  },
  selector_situation3: function (e) {
    var that = this
    that.setData({
      showView: (!that.data.showView),
      ca_ca_HousingSituation: 3
    })
    // wx.setStorage({
    //   key: 'ca_ca_HousingSituation',
    //   data: that.data.ca_ca_HousingSituation,
    // })
  },
  selector_situation4: function (e) {
    var that = this
    that.setData({
      showView: (!that.data.showView),
      ca_ca_HousingSituation: 4
    })
    // wx.setStorage({
    //   key: 'ca_ca_HousingSituation',
    //   data: that.data.ca_ca_HousingSituation,
    // })
  },
  selector_situation5: function (e) {
    var that = this
    that.setData({
      showView: (!that.data.showView),
      ca_ca_HousingSituation: 5
    })
    // wx.setStorage({
    //   key: 'ca_ca_HousingSituation',
    //   data: that.data.ca_ca_HousingSituation,
    // })
  },
  //点击标题隐藏和显示
  title_orientation: function (e) {
    var that = this
    that.setData({
      showView2: (!that.data.showView2),
    })
  },
  // 点击选项卡--房屋朝向
  selector_orientation1: function (e) {
    var that = this
    that.setData({
      showView2: (!that.data.showView2),
      ca_HouseOrientation: '东西'
    })
    // wx.setStorage({
    //   key: 'ca_HouseOrientation',
    //   data: that.data.ca_HouseOrientation,
    // })
  },
  selector_orientation2: function (e) {
    var that = this
    that.setData({
      showView2: (!that.data.showView2),
      ca_HouseOrientation: '南北'
    })
    // wx.setStorage({
    //   key: 'ca_HouseOrientation',
    //   data: that.data.ca_HouseOrientation,
    // })
  },
  //点击标题隐藏和显示
  title_publiccorridor: function (e) {
    var that = this
    that.setData({
      showView3: (!that.data.showView3),
    })
  },
  // 点击选项卡--占用公共过道
  selector_publiccorridor1: function (e) {
    var that = this
    that.setData({
      showView3: (!that.data.showView3),
      ca_OccupyPublicCorridor: '1'
    })
    // wx.setStorage({
    //   key: 'ca_OccupyPublicCorridor',
    //   data: that.data.ca_OccupyPublicCorridor,
    // })
  },
  selector_publiccorridor2: function (e) {
    var that = this
    that.setData({
      showView3: (!that.data.showView3),
      ca_OccupyPublicCorridor: '2'
    })
    // wx.setStorage({
    //   key: 'ca_OccupyPublicCorridor',
    //   data: that.data.ca_OccupyPublicCorridor,
    // })
  },
  //点击标题隐藏和显示
  title_smoothr: function (e) {
    var that = this
    that.setData({
      showView4: (!that.data.showView4),
    })
  },
  // 点击选项卡--地面是否平整
  selector_smoothr1: function (e) {
    var that = this
    that.setData({
      showView4: (!that.data.showView4),
      ca_isGroundSmooth: '是'
    })
    // wx.setStorage({
    //   key: 'ca_isGroundSmooth',
    //   data: that.data.ca_isGroundSmooth,
    // })
  },
  selector_smoothr2: function (e) {
    var that = this
    that.setData({
      showView4: (!that.data.showView4),
      ca_isGroundSmooth: '否'
    })
    // wx.setStorage({
    //   key: 'ca_isGroundSmooth',
    //   data: that.data.ca_isGroundSmooth,
    // })
  },
  //点击标题隐藏和显示
  title_ground: function (e) {
    var that = this
    that.setData({
      showView5: (!that.data.showView5),
    })
  },
  // 点击选项卡--原地面材质
  selector_ground1: function (e) {
    var that = this
    that.setData({
      showView5: (!that.data.showView5),
      ca_OriginalGroundMaterial: '水泥毛坯'
    })
  },
  selector_ground2: function (e) {
    var that = this
    that.setData({
      showView5: (!that.data.showView5),
      ca_OriginalGroundMaterial: '水泥找平'
    })
  },
  selector_ground3: function (e) {
    var that = this
    that.setData({
      showView5: (!that.data.showView5),
      ca_OriginalGroundMaterial: '防静电地板'
    })
  },
  selector_ground4: function (e) {
    var that = this
    that.setData({
      showView5: (!that.data.showView5),
      ca_OriginalGroundMaterial: '地毯'
    })
  },
  selector_ground5: function (e) {
    var that = this
    that.setData({
      showView5: (!that.data.showView5),
      ca_OriginalGroundMaterial: '地砖'
    })
  },
  selector_ground6: function (e) {
    var that = this
    that.setData({
      showView5: (!that.data.showView5),
      ca_OriginalGroundMaterial: '木地板'
    })
  },
  selector_ground7: function (e) {
    var that = this
    that.setData({
      showView5: (!that.data.showView5),
      ca_OriginalGroundMaterial: '塑胶地板'
    })
  },
  //点击标题隐藏和显示
  title_top: function (e) {
    var that = this
    that.setData({
      showView6: (!that.data.showView6),
    })
  },
  // 点击选项卡--原顶面材质
  selector_top1: function (e) {
    var that = this
    that.setData({
      showView6: (!that.data.showView6),
      ca_OriginalTopMaterial: '水泥毛坯'
    })
  },
  selector_top2: function (e) {
    var that = this
    that.setData({
      showView6: (!that.data.showView6),
      ca_OriginalTopMaterial: '矿棉板吊顶'
    })
  },
  selector_top3: function (e) {
    var that = this
    that.setData({
      showView6: (!that.data.showView6),
      ca_OriginalTopMaterial: '石膏板吊顶'
    })
  },
  selector_top4: function (e) {
    var that = this
    that.setData({
      showView6: (!that.data.showView6),
      ca_OriginalTopMaterial: '铝方通/格栅'
    })
  },
  selector_top5: function (e) {
    var that = this
    that.setData({
      showView6: (!that.data.showView6),
      ca_OriginalTopMaterial: '铝扣板吊顶'
    })
  },
  //点击标题隐藏和显示
  title_window: function (e) {
    var that = this
    that.setData({
      showView7: (!that.data.showView7),
    })
  },
  // 点击选项卡--窗户类型
  selector_window1: function (e) {
    var that = this
    that.setData({
      showView7: (!that.data.showView7),
      ca_WindowType: '玻璃幕墙'
    })
  },
  selector_window2: function (e) {
    var that = this
    that.setData({
      showView7: (!that.data.showView7),
      ca_WindowType: '飘窗'
    })
  },
  selector_window3: function (e) {
    var that = this
    that.setData({
      showView7: (!that.data.showView7),
      ca_WindowType: '普通窗'
    })
  },
  selector_window4: function (e) {
    var that = this
    that.setData({
      showView7: (!that.data.showView7),
      ca_WindowType: '落地窗'
    })
  },
  //点击标题隐藏和显示
  title_window: function (e) {
    var that = this
    that.setData({
      showView8: (!that.data.showView8),
    })
  },
  // 点击选项卡--窗户类型
  selector_wall1: function (e) {
    var that = this
    that.setData({
      showView8: (!that.data.showView8),
      ca_OriginalWallMaterial: '水泥'
    })
  },
  selector_wall2: function (e) {
    var that = this
    that.setData({
      showView8: (!that.data.showView8),
      ca_OriginalWallMaterial: '刮大白'
    })
  },
  selector_wall3: function (e) {
    var that = this
    that.setData({
      showView8: (!that.data.showView8),
      ca_OriginalWallMaterial: '乳胶漆'
    })
  },
  selector_wall4: function (e) {
    var that = this
    that.setData({
      showView8: (!that.data.showView8),
      ca_OriginalWallMaterial: '墙纸'
    })
  },

  // input控件数据处理
  bindchange: function (e) {
    var that = this
    var val = e.detail.value
    console.log(val)
    switch (e.target.id) {
      case "ca_CargoDoorHight":
        that.setData({
          ca_CargoDoorHight: val
        })
        break;
      case "ca_CargoDoorWide":
        that.setData({
          ca_CargoDoorWide: val
        })
        break;
      case "ca_GroundElevation":
        that.setData({
          ca_GroundElevation: val
        })
        break;
      case "ca_SpaceMaxHeight":
        that.setData({
          ca_SpaceMaxHeight: val
        })
        break;
      case "ca_SpaceMinHeight":
        that.setData({
          ca_SpaceMinHeight: val
        })
        break;
      case "ca_mainBeamHeight":
        that.setData({
          ca_mainBeamHeight: val
        })
        break;
      case "ca_SecondaryHeight":
        that.setData({
          ca_SecondaryHeight: val
        })
        break;
      case "ca_MinimumSprayHeight":
        that.setData({
          ca_MinimumSprayHeight: val
        })
        break;
      case "ca_AirConditionerNum":
        that.setData({
          ca_AirConditionerNum: val
        })
        break;
      case "ca_TuyereMinimumHeight":
        that.setData({
          ca_TuyereMinimumHeight: val
        })
        break;
      case "ca_StrongBoxNum":
        that.setData({
          ca_StrongBoxNum: val
        })
        break;
      case "ca_WeakBoxNum":
        that.setData({
          ca_WeakBoxNum: val
        })
        break;
      case "ca_UpWaterSpot":
        that.setData({
          ca_UpWaterSpot: val
        })
        break;
      case "ca_DownWaterSpot":
        that.setData({
          ca_DownWaterSpot: val
        })
        break;
      case "ca_DownWaterSpotSize":
        that.setData({
          ca_DownWaterSpotSize: val
        })
        break;
      case "ca_CurtainWallSpacing":
        that.setData({
          ca_CurtainWallSpacing: val
        })
        break;
      case "ca_windowsillHight":
        that.setData({
          ca_windowsillHight: val
        })
        break;
      case "ca_WindowHight":
        that.setData({
          ca_WindowHight: val
        })
        // wx.setStorage({
        //   key: 'ca_WindowHight',
        //   data: that.data.ca_WindowHight,
        // })
        break;
    }
  },

  // 提交数据
  submit: function () {
    var that = this
    console.log('ci_rwdid', that.data.ci_rwdid)
    console.log('ca_ca_HousingSituation', that.data.ca_ca_HousingSituation)
    console.log('ca_isGroundSmooth', that.data.ca_isGroundSmooth)
    console.log('ca_CargoDoorHight', that.data.ca_CargoDoorHight)
    console.log('ca_CargoDoorWide', that.data.ca_CargoDoorWide)
    console.log('ca_OriginalGroundMaterial', that.data.ca_OriginalGroundMaterial)
    console.log('ca_OriginalWallMaterial', that.data.ca_OriginalWallMaterial)
    console.log('ca_OriginalTopMaterial', that.data.ca_OriginalTopMaterial)
    console.log('ca_GroundElevation', that.data.ca_GroundElevation)
    console.log('ca_SpaceMaxHeight', that.data.ca_SpaceMaxHeight)
    console.log('ca_SpaceMinHeight', that.data.ca_SpaceMinHeight)
    console.log('ca_mainBeamHeight', that.data.ca_mainBeamHeight)
    console.log('ca_SecondaryHeight', that.data.ca_SecondaryHeight)
    console.log('ca_MinimumSprayHeight', that.data.ca_MinimumSprayHeight)
    console.log('ca_AirConditionerNum', that.data.ca_AirConditionerNum)
    console.log('ca_TuyereMinimumHeight', that.data.ca_TuyereMinimumHeight)
    console.log('ca_StrongBoxNum', that.data.ca_StrongBoxNum)
    console.log('ca_WeakBoxNum', that.data.ca_WeakBoxNum)
    console.log('ca_UpWaterSpot', that.data.ca_UpWaterSpot)
    console.log('ca_DownWaterSpot', that.data.ca_DownWaterSpot)
    console.log('ca_DownWaterSpotSize', that.data.ca_DownWaterSpotSize)
    console.log('ca_CurtainWallSpacing', that.data.ca_CurtainWallSpacing)
    console.log('ca_WindowType', that.data.ca_WindowType)
    console.log('ca_windowsillHight', that.data.ca_windowsillHight)
    console.log('ca_WindowHight', that.data.ca_WindowHight)

    if (that.data.ci_rwdid == null || that.data.ca_OriginalWallMaterial == null ||
      that.data.ca_ca_HousingSituation == null || that.data.ca_OccupyPublicCorridor == null ||
      that.data.ca_isGroundSmooth == null || that.data.ca_CargoDoorHight == null ||
      that.data.ca_CargoDoorWide == null || that.data.ca_OriginalGroundMaterial == null ||
      that.data.ca_OriginalTopMaterial == null || that.data.ca_GroundElevation == null ||
      that.data.ca_SpaceMaxHeight == null || that.data.ca_mainBeamHeight == null ||
      that.data.ca_SecondaryHeight == null || that.data.ca_MinimumSprayHeight == null ||
      that.data.ca_AirConditionerNum == null || that.data.ca_TuyereMinimumHeight == null ||
      that.data.ca_StrongBoxNum == null || that.data.ca_WeakBoxNum == null ||
      that.data.ca_UpWaterSpot == null || that.data.ca_DownWaterSpot == null ||
      that.data.ca_DownWaterSpotSize == null || that.data.ca_CurtainWallSpacing == null ||
      that.data.ca_WindowType == null || that.data.ca_windowsillHight == null ||
      that.data.ca_WindowHight == null || that.data.ca_SpaceMinHeight == null
    ) {
      // wx.showToast({
      //   title: '请将信息填写完整!',
      //   icon: 'warn',
      //   duration: 2000
      // })
      wx.showModal({
        title: '提示',
        content: '请将信息填写完整!',
        success: function (res) {
          if (res.confirm) {
            console.log('用户点击确定')
          } else if (res.cancel) {
            console.log('用户点击取消')
          }
        }
      })
    } else {
      wx.request({
        url: 'https://api.wenes.cn/JD/UpdateClientDetailInfo',
        method: 'POST',
        header: {
          'content-type': 'application/json'
        },
        data: {
          ci_rwdid: that.data.ci_rwdid,
          ca_ca_HousingSituation: that.data.ca_ca_HousingSituation,
          ca_HouseOrientation: that.data.ca_HouseOrientation,
          ca_OccupyPublicCorridor: that.data.ca_OccupyPublicCorridor,
          ca_isGroundSmooth: that.data.ca_isGroundSmooth,
          ca_CargoDoorHight: that.data.ca_CargoDoorHight,
          ca_CargoDoorWide: that.data.ca_CargoDoorWide,
          ca_OriginalGroundMaterial: that.data.ca_OriginalGroundMaterial,
          ca_OriginalWallMaterial: that.data.ca_OriginalWallMaterial,
          ca_OriginalTopMaterial: that.data.ca_OriginalTopMaterial,
          ca_GroundElevation: that.data.ca_GroundElevation,
          ca_SpaceMaxHeight: that.data.ca_SpaceMaxHeight,
          ca_SpaceMinHeight: that.data.ca_SpaceMinHeight,
          ca_mainBeamHeight: that.data.ca_mainBeamHeight,
          ca_SecondaryHeight: that.data.ca_SecondaryHeight,
          ca_MinimumSprayHeight: that.data.ca_MinimumSprayHeight,
          ca_AirConditionerNum: that.data.ca_AirConditionerNum,
          ca_TuyereMinimumHeight: that.data.ca_TuyereMinimumHeight,
          ca_StrongBoxNum: that.data.ca_StrongBoxNum,
          ca_WeakBoxNum: that.data.ca_WeakBoxNum,
          ca_UpWaterSpot: that.data.ca_UpWaterSpot,
          ca_DownWaterSpot: that.data.ca_DownWaterSpot,
          ca_DownWaterSpotSize: that.data.ca_DownWaterSpotSize,
          ca_CurtainWallSpacing: that.data.ca_CurtainWallSpacing,
          ca_WindowType: that.data.ca_WindowType,
          ca_windowsillHight: that.data.ca_windowsillHight,
          ca_WindowHight: that.data.ca_WindowHight,
        },
        success: function (res) {
          console.log(res)
          if (res.data == 1) {
            wx.showToast({
              title: '成功',
              icon: 'success',
              duration: 2000
            })
            wx.clearStorage()
          } else {
            showView: true
            showView2: true
            showView3: true
            showView4: true
            showView5: true
            showView6: true
            showView7: true
            wx.showToast({
              title: '失败',
              icon: 'success',
              duration: 2000
            })
          }
        }
      })
    }


  },


  // 页面跳转
  surroundings: function () {
    var that = this
    wx.redirectTo({
      url: 'surroundings?ci_rwdid=' + that.data.ci_rwdid + '&WorksID=' + that.data.WorksID + '&CustomerID=' + that.data.CustomerID,
    })
  },
  demand: function () {
    var that = this
    wx.redirectTo({
      url: 'demand?ci_rwdid=' + that.data.ci_rwdid,
    })
  },
  upkeep: function () {
    var that = this
    wx.redirectTo({
      url: 'upkeep?ci_rwdid=' + that.data.ci_rwdid,
    })
  },

})